package com.store.app.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.store.app.BaseActivity;
import com.store.app.R;

/**
 * 特卖--掌上超市
 */
public class PalmSupermarketActivity extends BaseActivity implements View.OnClickListener {

    private ImageView public_ll_return;
    private TextView tvTitle;
    private TextView public_tv_right;

    private TextView tv_store;//店铺
    private TextView tv_goods;//商品
    private TextView tv_promote_sale;//促销
    private TextView tv_delivery;//配送
    private TextView tv_preview;//预览

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initView();
        initListener();
        initData();
    }

    private void initView() {
        setContentView(R.layout.activity_palm_supermarket);
        public_ll_return = (ImageView) findViewById(R.id.public_ll_return);
        tvTitle = (TextView) findViewById(R.id.tvTitle);
        public_tv_right = (TextView) findViewById(R.id.public_tv_right);

        tv_store = (TextView) findViewById(R.id.tv_store);
        tv_goods = (TextView) findViewById(R.id.tv_goods);
        tv_promote_sale = (TextView) findViewById(R.id.tv_promote_sale);
        tv_delivery = (TextView) findViewById(R.id.tv_delivery);
        tv_preview = (TextView) findViewById(R.id.tv_preview);
    }

    private void initListener() {
        public_ll_return.setOnClickListener(this);
        public_tv_right.setOnClickListener(this);

        tv_store.setOnClickListener(this);
        tv_goods.setOnClickListener(this);
        tv_promote_sale.setOnClickListener(this);
        tv_delivery.setOnClickListener(this);
        tv_preview.setOnClickListener(this);
    }

    private void initData() {
        initTitleBar();
    }

    private void initTitleBar() {
        tvTitle.setText("掌上超市");
//        public_tv_right.setBackgroundResource(R.drawable.pic_icon_help);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.public_ll_return:
                finish();
                break;
            case R.id.public_tv_right:

                break;
            case R.id.tv_store:
                startActivity(new Intent(PalmSupermarketActivity.this,StoresActivity.class));
                break;
            case R.id.tv_goods:
                startActivity(new Intent(PalmSupermarketActivity.this,GoodsActivity.class));
                break;
            case R.id.tv_promote_sale:
                startActivity(new Intent(PalmSupermarketActivity.this,ScalePromotion_funActivity.class));
                break;
            case R.id.tv_delivery:
                enterDeliveryActivity();
                break;
            case R.id.tv_preview:
                startActivity(new Intent(PalmSupermarketActivity.this,StorePreviewActivity.class));
                break;
        }
    }

    /**
     * 进入特卖--配送界面
     */
    private void enterDeliveryActivity() {
        Intent intent = new Intent(this,DeliveryActivity.class);
        startActivity(intent);
    }
}
